/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.CompleteActions;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.BasicActions.InputPin;
import edu.pku.sei.modeler.model.uml.Kernel.Classifier;
import edu.pku.sei.modeler.model.uml.Kernel.Classifier;

import edu.pku.sei.modeler.model.uml.FundamentalActivities.Action;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;

/**
 * @generated
 *
 */
public class ReclassifyObjectAction extends Action implements IReclassifyObjectAction {
	// attributes
	
	protected boolean isReplaceAll;
	
	protected InputPin object;
	
	
	
	
	// references
	
	protected MetaTypedList newClassifier;
	
	protected MetaTypedList oldClassifier;
	
	
	
	// getters & setters for attributes
	
	@MethodProperty(
			id = "RECLASSIFYOBJECTACTION_ISREPLACEALL",
			catalog = "Model",
			name = ModelPackage.RECLASSIFYOBJECTACTION_ISREPLACEALL,
			setter = "setisReplaceAll"
			)
	
	public boolean getIsReplaceAll() {
		return isReplaceAll;
	}
	public void setIsReplaceAll(boolean newIsReplaceAll) {
		boolean oldisReplaceAll = isReplaceAll;
		isReplaceAll = newIsReplaceAll;
		firePropertyChange(ModelPackage.RECLASSIFYOBJECTACTION_ISREPLACEALL, oldisReplaceAll, newIsReplaceAll);
	}
	
	public InputPin getObject() {
		return object;
	}
	public void setObject(InputPin newObject) {
		InputPin oldobject = object;
		object = newObject;
		firePropertyChange(ModelPackage.RECLASSIFYOBJECTACTION_OBJECT, oldobject, newObject);
	}
	
	// getters for references
	
	public MetaTypedList getNewClassifier() {
		if(newClassifier == null) {
			newClassifier = new MetaTypedList(Classifier.class, this, ModelPackage.RECLASSIFYOBJECTACTION_NEWCLASSIFIER);
		}
		return newClassifier;
	}
	
	public MetaTypedList getOldClassifier() {
		if(oldClassifier == null) {
			oldClassifier = new MetaTypedList(Classifier.class, this, ModelPackage.RECLASSIFYOBJECTACTION_OLDCLASSIFIER);
		}
		return oldClassifier;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.RECLASSIFYOBJECTACTION_ISREPLACEALL, isReplaceAll);
		
		XMLUtility.xmlInstance.serializeNode(root, ModelPackage.RECLASSIFYOBJECTACTION_OBJECT, object);
		
		// references
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.RECLASSIFYOBJECTACTION_NEWCLASSIFIER, newClassifier);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.RECLASSIFYOBJECTACTION_OLDCLASSIFIER, oldClassifier);		
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		isReplaceAll = XMLUtility.xmlInstance.deSerializeBoolean(root, ModelPackage.RECLASSIFYOBJECTACTION_ISREPLACEALL);
		
		object = (InputPin)XMLUtility.xmlInstance.deSerializeNode(root, ModelPackage.RECLASSIFYOBJECTACTION_OBJECT, this);
		
		// references
		
		this.getNewClassifier().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.RECLASSIFYOBJECTACTION_NEWCLASSIFIER, this));
		
		this.getOldClassifier().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.RECLASSIFYOBJECTACTION_OLDCLASSIFIER, this));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		else if(ModelPackage.RECLASSIFYOBJECTACTION_OBJECT.equals(featureID)) {
			object = (InputPin)value;
		}
		
		// references
		
		else if(ModelPackage.RECLASSIFYOBJECTACTION_NEWCLASSIFIER.equals(featureID)) {
			getNewClassifier().add(value);
		}
		
		else if(ModelPackage.RECLASSIFYOBJECTACTION_OLDCLASSIFIER.equals(featureID)) {
			getOldClassifier().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 